stage.set_background("moon")
sprite = codesters.Sprite("astronaut1")
sprite.go_to(-125, -150)
glorp = codesters.Sprite("alien1")
glorp.go_to(100, -125)
rock = codesters.Sprite("asteroid")
t = codesters.Teacher()
try:
tval1 = rock.get_x()
tval1b = rock.get_y()
except:
tval1 = "DNE"
tval1b = "DNE"
try:
tval2 = sprite.get_x()
tval2b = sprite.get_y()
except:
tval2 = "DNE"
tval2b = "DNE"
t1 = TestObjective()
t1.add_success(tval1 == 100, "Great Job!")
t1.add_failure(tval2 == 100 and tval2b == 75 and tval1 != 100 and tval1b != 75, "Make sure you change the name in front of your Go To command to rock.")
t1.add_failure(tval1 == 0 and tval1b == 0, "Did you add a Go To command to the rock sprite?")
t1.add_failure(tval1 == -100, "Did you change the x-coordinate in the Go To command?")
t1.add_failure(tval1 == "DNE", "Did you delete or rename rock?")
t2 = TestObjective()
t2.add_success(tval1b == 75, "Great job!")
t2.add_failure(tval1b == 0, "Did you add a Go To command to the rock sprite?")
t2.add_failure(tval1b == -50, "Did you change the y-coordinate in the Go To command?")
t2.add_failure(tval1b == "DNE", "Did you delete the rock sprite?")
tester = TestManager()
tester.add_test_list([t1, t2])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)